package com.bwie.system.task;

import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.User;
import com.bwie.common.domain.UserMsg;
import com.bwie.system.sms.SendSmsUtils;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @className: RabbitCustomer
 * @Description: TODO
 * @version: v1.８.0
 * @author:
 * @date:
 */
@Component
public class RabbitCustomer {
    @Autowired
    private SendSmsUtils sendSmsUtils;

    @RabbitListener(queuesToDeclare = @Queue("sendMs"))
    public void sendMs(String msg){
        UserMsg userMsg = JSONObject.parseObject(msg, UserMsg.class);
        System.out.println(userMsg.getMsg());
        User user = userMsg.getUser();
        System.out.println(userMsg.getMsg());
    }
}
